/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.edu.amu.wmi.kino.visualjavafx.model.generators;

import pl.edu.amu.wmi.kino.visualjavafx.model.api.*;
import java.awt.Color;
import java.util.ArrayList;
import pl.edu.amu.wmi.kino.visualjavafx.model.objects.Application;
import pl.edu.amu.wmi.kino.visualjavafx.model.objects.Canvas;
import pl.edu.amu.wmi.kino.visualjavafx.model.objects.shapes.Circle;
import pl.edu.amu.wmi.kino.visualjavafx.model.objects.Frame;
/**
 *
 * @author psychollek
 */
public class SampleModelProvider implements VisualJavaFxModelProvider{

    @Override
    public Application getModel() {
        return this.generateModel();
    }

    private Circle generateCircle(double cx,double cy,double radius,Color fill,Color border,double strokeWidth){
        Circle c=new Circle();
        c.setHPos(cx);
        c.setVPos(cy);
        c.setRadious(radius);
        c.setFillColor(fill);
        c.setBorderColor(border);
        c.setBorderWidth(strokeWidth);
        return c;
    }

    private Canvas generateCanvas(Color background){
        Canvas can = new Canvas();
        can.setVisibility(true);
        can.setBgColor(background);
        return can;
    }

    private Frame generateFrame(int width,int height,int screenX,int screenY,String title,Canvas canvas){
        Frame f = new Frame();
        f.setWidth(width);
        f.setHeight(height);
        f.setHScreenPosition(screenX);
        f.setVScreenPosition(screenY);
        f.setTitle(title);
        f.setVisibility(true);
        f.setCanvas(canvas);
        f.setResizable(true);
        return f;

    }
    private Application generateModel(){
        Application app = new Application();
        ArrayList<Frame> frames = app.getFrames();
        Circle c = this.generateCircle(100, 100, 50, Color.WHITE, Color.BLACK, 10);
        Canvas can=this.generateCanvas(Color.CYAN);
        (can.getContent()).add(c);
        frames.add(this.generateFrame(1000, 800, 100, 100, "testowa", can));
        return app;

    }


    @Override
    public void addModelChangeListener(ModelChangeListener listener) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void notifyModelChange(ModelChangeEvent evt) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void removeModelChangeListener(ModelChangeListener listener) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}
